home *** CD-ROM | disk | FTP | other *** search
/ The Atari Compendium / The Atari Compendium (Toad Computers) (1994).iso / files / prgtools / programm.ing / gfa / gfaexprt.lzh / GFAXPERT.LIB / DEBUG.LST < prev    next >
Encoding:
File List  |  1986-10-19  |  3.7 KB  |  133 lines

  1. ' *****************
  2. ' *** DEBUG.LST ***
  3. ' *****************
  4. '
  5. DEFWRD "a-z"
  6. '
  7. > PROCEDURE debug
  8.   ' *** Merge (temporarily) with a program if you need help with debugging
  9.   ' *** activate Procedure Debug in main program with : TRON debug
  10.   ' *** run program, press <Alternate> <Control> <Right Shift> for debug-menu
  11.   ' *** uses VT52-commands (on TOS-screen, not in window)
  12.   ' *** uses Standard Globals
  13.   ' *** Global :  DEBUG.SPEED  DEBUG.TRON!  DEBUG.LINE$  DEBUG.LINES
  14.   LOCAL screen$,dump.par$,scr%,sy,dy
  15.   IF BIOS(11,-1)=13 OR INSTR(TRACE$,debug.line$)
  16.     PRINT CHR$(27)+"j";         ! save current cursor-position
  17.     SGET screen$                ! save screen
  18.     DO
  19.       IF debug.lines<1
  20.         debug.lines=4
  21.       ENDIF
  22.       CLS
  23.       PRINT AT(1,2);" *** GFA-BASIC DEBUGGER ***"
  24.       PRINT
  25.       PRINT " <S> Stop program (Command mode)"
  26.       PRINT
  27.       PRINT " <D> Change TRON-delay"
  28.       PRINT " <L> TRON-lines on screen"
  29.       IF debug.tron!
  30.         PRINT " <T> Switch TRON off"
  31.       ELSE
  32.         PRINT " <T> Switch TRON on"
  33.       ENDIF
  34.       PRINT
  35.       PRINT " <V> Dump variables to screen"
  36.       PRINT " <P> Dump procedures/functions"
  37.       PRINT " <B> Dump labels"
  38.       PRINT
  39.       PRINT " <W> Wait for string (breakpoint)"
  40.       PRINT
  41.       PRINT " <C> Continue with main program"
  42.       PRINT
  43.       PRINT " <Q> Quit program, go to editor"
  44.       PRINT AT(1,20);" Delay = ";debug.speed;"/50 s     TRON = ";
  45.       IF debug.tron!
  46.         PRINT "on (";debug.lines;" lines)"
  47.       ELSE
  48.         PRINT "off"
  49.       ENDIF
  50.       IF debug.line$<>""
  51.         PRINT " Search-string: ";debug.line$
  52.       ENDIF
  53.       '
  54.       IF INSTR(TRACE$,debug.line$)
  55.         PRINT AT(1,23);"String found:"
  56.       ELSE
  57.         PRINT AT(1,23);"Current line:"
  58.       ENDIF
  59.       OUT 5,3
  60.       PRINT " ";TRACE$;
  61.       '
  62.       SELECT UPPER$(CHR$(INP(2)))
  63.       CASE "S"
  64.         KEYPRESS &H1C000D
  65.         STOP
  66.       CASE "D"
  67.         PRINT AT(1,21);SPACE$(80);
  68.         PRINT AT(1,21);" Delay (in 1/50 s): ";
  69.         INPUT "",debug.speed
  70.       CASE "L"
  71.         PRINT AT(1,21);SPACE$(80);
  72.         PRINT AT(1,21);" TRON-lines (≥1): ";
  73.         INPUT "",debug.lines
  74.       CASE "T"
  75.         debug.tron!=NOT debug.tron!
  76.       CASE "V"
  77.         PRINT AT(1,21);SPACE$(80);
  78.         PRINT AT(1,21);" DUMP-Parameter: ";
  79.         INPUT "",dump.par$
  80.         CLS
  81.         PRINT " *** Use <CapsLock> or right <Shift> ***"
  82.         PRINT
  83.         DUMP dump.par$
  84.         PRINT
  85.         PRINT " (Press any key to continue)";
  86.         ~INP(2)
  87.       CASE "P"
  88.         CLS
  89.         PRINT " *** Use <CapsLock> or right <Shift> ***"
  90.         PRINT
  91.         DUMP "@"
  92.         PRINT
  93.         PRINT " (Press any key to continue)";
  94.         ~INP(2)
  95.       CASE "B"
  96.         CLS
  97.         PRINT " *** Use <CapsLock> or right <Shift> ***"
  98.         PRINT
  99.         DUMP ":"
  100.         PRINT
  101.         PRINT " (Press any key to continue)";
  102.         ~INP(2)
  103.       CASE "W"
  104.         PRINT AT(1,21);SPACE$(80);
  105.         PRINT AT(1,21);" Search-string: ";
  106.         INPUT "",debug.line$
  107.       CASE "C"
  108.         EXIT IF TRUE
  109.       CASE "Q"
  110.         EDIT
  111.       ENDSELECT
  112.     LOOP
  113.     SPUT screen$                ! restore screen
  114.     PRINT CHR$(27)+"k";         ! restore cursor
  115.   ENDIF
  116.   '
  117.   PAUSE debug.speed
  118.   '
  119.   IF debug.tron!
  120.     IF debug.lines>1
  121.       scr%=XBIOS(2)                        ! physical screen
  122.       sy=MUL(SUCC(SUB(scrn.lin.max,debug.lines)),char.height)
  123.       dy=SUB(sy,char.height)
  124.       RC_COPY scr%,0,sy,scrn.x.max,MUL(PRED(debug.lines),char.height) TO scr%,0,dy
  125.       PRINT AT(1,scrn.lin.max);"jwK";TRACE$;"kv";
  126.     ELSE
  127.       PRINT AT(1,scrn.lin.max);"jwK";TRACE$;"kv";
  128.     ENDIF
  129.   ENDIF
  130. RETURN
  131. ' **********
  132. '
  133.